package com.didd.core.sensitive.annotation;


import com.didd.core.sensitive.core.SensitiveSerialize;
import com.didd.core.sensitive.strategy.DefaultSensitiveStrategy;
import com.didd.core.sensitive.strategy.IStrategy;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * 实体类中需要通过字典映射的属性配置
 *
 * @author diddd
 * @date: 2021-07-28 10:20:06
 */
@Inherited
@JacksonAnnotationsInside
@Retention(RetentionPolicy.RUNTIME)
@JsonSerialize(using = SensitiveSerialize.class)
public @interface Sensitive {

    /**
     * 脱敏策略
     *
     * @return
     */
    Class<? extends IStrategy> strategy() default DefaultSensitiveStrategy.class;

    /**
     * 输入格式，使用正则表达式, 优先级大于 strategy
     *
     * @return 格式
     */
    String pattern() default "";

    /**
     * 替换目标字符, 优先级大于 strategy
     *
     * @return 替换目标字符串
     */
    String replaceChar() default "";

    /**
     * 开始显示几位
     *
     * @return
     */
    int begin() default 0;

    /**
     * 结束显示几位
     *
     * @return
     */
    int end() default 0;

}
